package com.spring.bean.aware;

import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.test.context.ContextConfiguration;

/**
 * @ClassName: Main
 * @Author: suncx
 * @CreateDate: 2020-04-12 14:34
 * @Description:
 * 执行顺序
 * this is MyBeanTest init-method    <bean>init-method=""</bean>
 * afterPropertiesSet ---------      InitializingBean.afterPropertiesSet
 * this is MyBeanInitTest init-method  执行 initMetho
 * com.spring.bean.aware.MyBeanInitTest@17776a8  TestAware.testAware
 *
 */
@ContextConfiguration(locations = { "classpath:log4j2.xml" })
public class Main {
    @Test
    public void test() {

        ApplicationContext bf = new ClassPathXmlApplicationContext("/bean/BeanAwareTest.xml");
        TestAware testAware = (TestAware) bf.getBean("testAware");
        testAware.testAware();
    }
}
